{include file="public/toper"/}
<style>
    .table_td {text-align: center;}
    .table_p {height: 20px;}
    .layui-table {width: 80%;margin: 0 auto;text-align: left;}
    .tis {margin-left:6%;}
    .color {color: #FF0000}
    .a {width: 80%;margin: 5px auto;}
</style>

<div class="x-body">
    <table class="layui-table">
        <p class="tis">结算信息</p>
        <tr>
            <td>结算单号：{$list['settlement_sn']}</td>
            <td>状态：<span class="color">{if condition="$list['pay_state'] eq 0"}未付款{elseif condition="$list['pay_state'] eq 1"/}已付款{/if}</span></td>
        </tr>
        <tr>
            <td>申请人：{$list['name']}</td>
            <td>申请时间：{$list['add_time']|date="Y-m-d H:i:s",###}</td>
        </tr>
        <tr>
            <td>结算订单数：<span class="color">{$list['orderid']}</span></td>
            <td>结算总费用：<span class="color">￥{$list['fees']}</span></td>
        </tr>
    </table>

    <p class="table_p"></p>
    <table class="layui-table">
        <p class="tis">结算明细</p>
        <thead>
        <tr>
            <th>序号</th>
            <th>订单编号</th>
            <th>商品信息</th>
            <th>销售金额</th>
            <th>结算金额</th>
            <th>下单时间/完成时间</th>
        </tr>
        </thead>

        <tbody>
        {volist name="$list['order']" id="vo" key="key"}
        <tr>
            <td>{$key}</td>
            <td>{$vo.order_sn}<br/>{if condition="$vo['type'] eq 1"}共享{elseif condition="$vo['type'] eq 2"/}销售{/if}</td>
            <td>{volist name="$vo['goods']" id="vv"}{$vv['gname']}     * {$vv['goods_number']}<br/>{if condition="$vo['type'] eq 1"}周期：{$vo['lease_end_time']}   日租：{$vv['settlement']}{/if}{/volist}</td>
            <td>{volist name="$vo['goods']" id="vv"}<span class="color">{$vv['goods_price']}</span>{/volist}<br/>{if condition="$vo['type'] eq 1"}逾期：{$vo['overdue_price']} <br/>磨损：{$vo['abrasion_price']}{/if}</td>
            <td>{volist name="$vo['goods']" id="vv"}{if condition="$vo['type'] eq 1"}<span class="color">{$vo['lease_end_time'] * $vo['business_settlement_price'] + $vo['abrasion_price']}</span>{elseif condition="$vo['type'] eq 2"/}<span class="color">{$vo['business_settlement_price']}</span>{/if}{/volist}<br/>{if condition="$vo['type'] eq 1"}{volist name="$vo['goods']" id="vv"}租金：{$vo['lease_end_time'] * $vv['settlement'] * $vv['goods_number']}<br/>{/volist}逾期：{$vo['overdue_price']}<br/>磨损：{$vo['abrasion_price']}{/if}</td>
            <td>{$vo['add_time']|date="Y-m-d H:i:s",###} <br/>{$vo['end_time']|date="Y-m-d H:i:s",###}</td>
        </tr>
        {/volist}
        </tbody>
    </table>

    <p class="table_p"></p>
    <p class="tis">付款信息</p>
    <form action="" method="post" class="layui-form" id="forms">
        <input type="hidden" name="settlement_id" value="{$list['settlement_id']}" class="layui-input">
        <div class="layui-form-item a">
            <label class="layui-form-label">商家账号</label>
            <div class="layui-input-inline" style="width: 800px;">
                <div class="layui-form-mid">
                    <span class="x-red"></span>银行：{$list.bank}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;       账户名称：{$list.username}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;       账号：{$list.number}
                </div>
            </div>
        </div>
        <div class="layui-form-item a">
            <label class="layui-form-label"><span class="x-red"></span>付款方式</label>
            <div class="layui-input-inline">
                <select name="pay_way">
                    <option value="0">支票</option>
                    <option value="1">贷记</option>
                    <option value="2">汇票</option>
                    <option value="3">现金</option>
                    <option value="4">银行卡</option>
                    <option value="5">其他</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item a">
            <label class="layui-form-label">
                <span class="x-red">*</span>付款金额
            </label>
            <div class="layui-input-inline">
                <input type="number" max="{$list.fees}" value="{$list.fees}"  name="pay_charge" required="" lay-verify="required" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item a">
            <label class="layui-form-label">
                <span class="x-red">*</span>支付凭证
            </label>
            <div class="layui-input-inline layui-upload" id="upload-thumb" style="width: 80%">
                <button type="button" class="layui-btn layui-btn-primary" id="image"><i class="layui-icon"></i>上传图片</button>
                <div class="layui-upload-list images-block-container" id="demo"></div>
                <p id="demoText"></p>
            </div>
        </div>
        <div class="layui-form-item a">
            <label class="layui-form-label">
                <span class="x-red"></span>备注信息
            </label>
            <div class="layui-input-inline" style="width: 80%">
                <textarea type="text" value="" name="note" required="" style="height: 200px;" class="layui-input"></textarea>
            </div>
        </div>
        <div class="layui-form-item" style="width: 68%;margin: 0 auto;">
            <button  class="layui-btn" lay-filter="formSubmit" lay-submit="">提交</button>
        </div>
    </form>

</div>
{include file="public/footer"/}
<script>
    layui.use(['form','upload'], function(){
        $ = layui.jquery;
        var form = layui.form,layer = layui.layer;
        var upload = layui.upload;
        //普通图片上传
        var uploadInst = upload.render({
            elem: '#image',
            url: "{:url('admin/Upload/voucher')}",
            ext: 'jpg|png|gif',
            multiple:true,
            number:8,
            drag:false,
            done: function(res){
                //如果上传失败
                if(res.code == 200 ){
                    $('#demo').append('<span class="image-block"><input type="hidden" name="pay_img[]" value="'+ res.data.src +'"><span class="del_btn"><i class="layui-icon">&#x1006;<img width="100" height="100" src="'+ res.data.src +'" class="layui-upload-img"></i></span></span>');
                }else {
                    layer.msg(res.msg);
                }
                //上传成功
            },
            error: function(){
                //演示失败状态，并实现重传
                var demoText = $('#demoText');
                demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini demo-reload">重试</a>');
                demoText.find('.demo-reload').on('click', function(){
                    uploadInst.upload();
                });
            }
        });
    });
</script>